<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Father(user, age) {
            this.user = user;
            this.age = age;
        }
        Father.prototype.moeny = function() {
            console.log(11000);
        }
        // 把父亲的this改为子的this
        function Son (user, age) {
            Father.call(this, user, age)
        }
        // 如果继承父亲原型的方法，需要做以下操作
        Son.prototype = new Father();
        // 上部操作会改变son的构造函数，需要改回来
        Son.prototype.constructor = Son;
        var son = new Son("ldh", 19);
        console.log(son);
        son.moeny();
    </script>
</body>
</html>